<!---<font size = 5>What do you want to do?</font><br><br> 
<font size = 2><strong><?php
	echo anchor('user/create_survey/'.$id,'Edit a survey'); 
	echo anchor(''.$id,"End a survey");
	echo "<br /><br /><br /><br />";	
?></strong></font> -->
<link  href="http://localhost/pollwatcher/public/css/table_style.css" rel="stylesheet" type="text/css" /><link rel="stylesheet" href="http://localhost/pollwatcher/public/css/table_style.css" type="text/css" media="screen" /> 

<script src="<?php echo base_url(); ?>public/js/jquery.js"></script>
<script src="<?php echo base_url(); ?>public/js/jquery.tablesorter.min.js"></script>
<?php
if($super == false)
{
	?><h2>My Surveys</h2><?php
}
else
{
	$user = $this->User_model->fetch($super);
	
	?><h2><?php echo $user['firstname']."'s Surveys"; ?></h2><?php
}
?>

<?php 
if($super==false)
{
	echo form_open('user/search_survey');
}

else
{
	echo form_open('user/search_survey/'.$super);
}
?>

<strong> Search survey </strong> <input type = "text" name="search" value="Enter Survey title">
<input type ='submit' name="submit" class = "reg" value="Search"><br/>


<table id="surveys" class="tablesorter"><thead><tr>
<th>Title</th><th>Description</th><th>Date Created</th><th>Begin Date</th><th>End Date</th></tr></thead>
<tbody>
<?php foreach($surveys->result() AS $test){ ?>
		<tr><td><?php echo anchor('user/view_certain_survey/'.$id.'/'.$test->survey_id,$test->title);?></td>
		<td><?php echo $test->description;?></td>
		<td><?php echo $test->date_created;?></td>
		<td><?php echo $test->begin_date;?></td>
		<td><?php echo $test->end_date;?></td></tr>
	
<?php	} ?>
<?php
	if ($surveys->num_rows == 0 && !isset($search)){
		echo "You have not created any surveys";
	}
	else if($surveys->num_rows == 0)
	{
		echo "No results found.";
	}
?>
</tbody>
</table>


<script type="text/javascript">
$(document).ready(function() 
    { 
        $("#surveys").tablesorter(); 
    } 
);
</script>
